$(function () {
  $('.input_sub').on('click', function (e) {
    e.preventDefault()
    let username = $('.input_txt')
      .val()
      .trim()
    let password = $('.input_pass')
      .val()
      .trim()
    if (!username || !password) {
      alert('输入的用户名或密码不能为空')
      return
    }
    $.ajax({
      type: 'post',
      url: BigNew.user_login,
      data: {
        username: username,
        password: password
        },
        success: function (backData) {
            if (backData.code == 200) {
             window.localStorage.setItem('token',backData.token)
             alert('登录成功')
             window.location.href='./index.html'
            } else {
                alert('登录失败')
         }
      }
    })
  })
})
